<?php


/*
 * Created on 2011-4-13
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

require ('../Common.inc.php');
require (SERVER_ROOT_PATH . '/config/base.config.php');
require (SERVER_ROOT_PATH . '/lib/Framework.class.php');

new Framework();

$u = new User('r');

$user = $u->getUserByName($_SESSION['username']);

$recordlist = $u->getRecordByUser($user[0]['identity']);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>读读</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <link rel="icon" href="/favicon.png"/>
                
        <script type="text/javascript" src="../js/combined.js?12"></script>
                <script type="text/javascript" src="../js/sharing.js?12"></script>

                <link rel="stylesheet" href="../css/main.css?12"/>
    </head>
    <body>
        <div id="header">
            <div id="userpanel">
                
                                    Hello, <b><?php echo $_SESSION['username'];?></b>.

                    <a href="/extras">Extras</a>
                    <span style="color: #ccc;">&bull;</span>

                    <a href="/user">Account</a>
                    <span style="color: #ccc;">&bull;</span>
                    <a href="logout.php">Log out</a>
                
            </div>

            <h1 id="logo">
                <a href="/u" class="logo">读读</a>
            </h1>

            <div style="font-size: 14px; margin-top: 8px;">A simple tool to save web pages for reading later.</div>
        </div>

        <div id="content">
            
<div id="left_column">
                <div class="pagination" id="paginationTop">
            <a href="/edit" style="text-decoration: none;"><span style="text-decoration: underline;">Add</span> +</a>

        </div>
    
    <h2 id="categoryHeader">
        <a style="font-weight: normal;" href="/browse">Browse</a>
        <span style="color: #ccc;">&bull;</span>

                    Unread
                <span style="color: #ccc;">&bull;</span>
                                    <a style="font-weight: normal;" href="/liked">Liked</a>
                            <span style="color: #ccc;">&bull;</span>

                    <a style="font-weight: normal;" href="/archive">Archive</a>
            </h2>

    <div class="foldermenu sharemenu" id="sharemenu">
        <div style="float: right;">
            <a href="#" onclick="document.getElementById('sharemenu').style.display = 'none'; return false;"
             style="color: #888; text-decoration: underline;"
            >cancel</a>
        </div>
        <div style="margin-bottom: 10px;">

            Share:
        </div>
        
        <div style="margin-top: 10px;">
            <a id="shareToEmail" href="#">
                <img src="/images/email-icon-tiny.png"/> Email
            </a>
        </div>
        
                
        
        
        
        
                
                    <div style="font-size: 11px; margin-top: 1em; color: #777;">
                Share with Facebook, Twitter, Tumblr, Pinboard, and Evernote                by <a href="/user">linking accounts</a>.
            </div>

            </div>
    <div class="foldermenu sharemenu" id="facebooksharemenu">
        <div style="float: right;">
            <a href="#" onclick="document.getElementById('facebooksharemenu').style.display = 'none'; return false;"
             style="color: #888; text-decoration: underline;"
            >cancel</a>
        </div>
        
        <img src="/images/facebook-icon-tiny.png"/> <b>Share on Facebook</b>
        
        <form id="share_to_facebook_form" action="/user/share_to_facebook" method="post" onsubmit="return share_to_facebook_submit();">

            <input type="hidden" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
            <input type="hidden" name="url" id="share_facebook_url" value=""/>

            <label for="share_facebook_comment">Comment:</label>
            <input type="text" class="text" id="share_facebook_comment" name="comment" placeholder="e.g. &ldquo;This was interesting.&rdquo;"/>

            <label for="share_facebook_title">Article Title:</label>
            <input type="text" class="text" id="share_facebook_title" name="title"/>

            <label for="share_facebook_selection">Article Quote:</label>
            <textarea name="selection" id="share_facebook_selection"></textarea>
            
            <div style="position: absolute; right: 20px; bottom: 20px; text-align: right;">
                <img id="share_to_facebook_loader" src="/images/loader-white.gif" style="display: none;"/>
                <input type="submit" id="share_to_facebook_submit_button" class="submit" style="width: 120px;" value="Post to Facebook"/>
            </div>
        </form>
    </div>

    <div class="foldermenu sharemenu" id="twittersharemenu">
        <div style="float: right;">
            <a href="#" onclick="document.getElementById('twittersharemenu').style.display = 'none'; return false;"
             style="color: #888; text-decoration: underline;"
            >cancel</a>
        </div>

        <img src="/images/twitter-icon-tiny.png"/> <b>Share on Twitter</b>

        <form id="share_to_twitter_form" action="/user/share_to_twitter" method="post" onsubmit="return share_to_twitter_submit();">

            <input type="hidden" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
            <input type="hidden" name="url" id="share_twitter_url" value=""/>

            <label for="share_twitter_tweet">Tweet:</label>
            <textarea id="share_twitter_tweet" name="tweet" 
             onkeyup="share_to_twitter_update_counter();"
             onchange="share_to_twitter_update_counter();"
            ></textarea>
            <div id="twitter_counter"></div>

            <div style="position: absolute; right: 20px; bottom: 20px; text-align: right;">
                <img id="share_to_twitter_loader" src="/images/loader-white.gif" style="display: none;"/>

                <input type="submit" id="share_to_twitter_submit_button" class="submit" style="width: 120px;" value="Post to Twitter"/>
            </div>
        </form>
    </div>
    <div class="foldermenu sharemenu" id="tumblrsharemenu">
        <div style="float: right;">
            <a href="#" onclick="document.getElementById('tumblrsharemenu').style.display = 'none'; return false;"
             style="color: #888; text-decoration: underline;"
            >cancel</a>
        </div>

        <img src="/images/tumblr-icon-tiny.png"/> <b>Post to Tumblr</b>

        <form id="share_to_tumblr_form" action="/user/share_to_tumblr" method="post" onsubmit="return share_to_tumblr_submit();">
            <input type="hidden" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
            <input type="hidden" name="url" id="share_tumblr_url" value=""/>

            <label for="share_tumblr_title">Title:</label>
            <input type="text" class="text" id="share_tumblr_title" name="title"/>

            <label for="share_tumblr_selection">Description:</label>
            <textarea name="selection" id="share_tumblr_selection" placeholder="(optional)"></textarea>

            <div style="position: absolute; right: 20px; bottom: 20px; text-align: right;">
                <img id="share_to_tumblr_loader" src="/images/loader-white.gif" style="display: none;"/>
                <input type="submit" id="share_to_tumblr_submit_button" class="submit" style="width: 120px;" value="Post to Tumblr"/>
            </div>
        </form>

    </div>
    <div class="foldermenu sharemenu" id="pinboardsharemenu">
        <div style="float: right;">
            <a href="#" onclick="document.getElementById('pinboardsharemenu').style.display = 'none'; return false;"
             style="color: #888; text-decoration: underline;"
            >cancel</a>
        </div>

        <img src="/images/pinboard-icon-tiny.png"/> <b>Post to Pinboard</b>

        <form id="share_to_pinboard_form" action="/user/share_to_pinboard" method="post" onsubmit="return share_to_pinboard_submit();">
            <input type="hidden" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
            <input type="hidden" name="url" id="share_pinboard_url" value=""/>

            <label for="share_pinboard_title">Title:</label>
            <input type="text" class="text" id="share_pinboard_title" name="title"/>

            <label for="share_pinboard_selection">Description:</label>
            <textarea name="selection" id="share_pinboard_selection" placeholder="(optional)"></textarea>

            <label for="share_pinboard_tags">Tags:</label>
            <input type="text" class="text" id="share_pinboard_tags" name="tags" placeholder="(optional, separated by spaces)"/>

            <div style="position: absolute; right: 20px; bottom: 20px; text-align: right;">
                <img id="share_to_pinboard_loader" src="/images/loader-white.gif" style="display: none;"/>
                <input type="submit" id="share_to_pinboard_submit_button" class="submit" style="width: 120px;" value="Post to Pinboard"/>
            </div>
        </form>

    </div>
    <div class="foldermenu sharemenu" id="evernotesharemenu">
        <div style="float: right;">
            <a href="#" onclick="document.getElementById('evernotesharemenu').style.display = 'none'; return false;"
             style="color: #888; text-decoration: underline;"
            >cancel</a>
        </div>

        <img src="/images/evernote-icon-tiny.png"/> <b>Post to Evernote</b>

        <form id="share_to_evernote_form" action="/user/share_to_evernote" method="post" onsubmit="return share_to_evernote_submit();">
            <input type="hidden" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
            <input type="hidden" name="bookmark_id" id="share_evernote_bookmark_id" value=""/>

            <label for="share_evernote_title">Title:</label>
            <input type="text" class="text" id="share_evernote_title" name="title"/>

            <label for="share_evernote_tags">Tags:</label>
            <input type="text" class="text" id="share_evernote_tags" name="tags" placeholder="(optional, comma-separated, must already exist in Evernote)"/>

            <label for="share_evernote_notebook">Notebook:</label>
            <input type="text" class="text" id="share_evernote_notebook" name="notebook" placeholder="(optional, must already exist in Evernote)"/>

            <div style="position: absolute; right: 20px; bottom: 20px; text-align: right;">
                <img id="share_to_evernote_loader" src="/images/loader-white.gif" style="display: none;"/>
                <input type="submit" id="share_to_evernote_submit_button" class="submit" style="width: 120px;" value="Post to Evernote"/>
            </div>
        </form>

    </div>

    <?php

if (count($recordlist) == 0) {
?>
        <div id="bookmark_list">            
            <div class="tableViewCell tableViewCellFirst tableViewCellLast" id="tableViewCell0" style="height: 60px;">
                <div style="text-align: center; margin-top: 20px;">
                                                                        No articles saved.
                                                            </div>
            </div>
        </div>
    
            <div style="margin: 10px 60px; text-align: center; padding: 20px;">

                            Drag this bookmarklet to your bookmarks toolbar:

                <div style="margin: 10px;">
                        <a href="javascript:(function(){readStyle='style-newspaper';readSize='size-large';readMargin='margin-wide';_readability_script=document.createElement('SCRIPT');_readability_script.type='text/javascript';_readability_script.src='http://www.xiabandu.com/user/jsfile.php?identity=<?php echo $user[0]['identity'];?>&x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(_readability_script);})();"
    class="bookmarklet"
    onclick="return explain_bookmarklet();"
    title="DUDU">DUDU</a>
                </div>
            
                        Then, next time you're on a page that you want to read later, just
            click that bookmark and it will be added to your Instapaper reading list.
                    </div>
    
    <?php

} else {
	echo '<div id="bookmark_list">';
	foreach($recordlist as $k=>$v){
		$csssuffix='';
		if($k==0)$csssuffix='tableViewCellFirst';
		if($k==count($recordlist)) $csssuffix='tableViewCellLast';
		if($v['userlike']===true) {
			$like='';
			$unlike='display:none;';
		}else{
			$like='display:none;';
			$unlike='';
		}
?>
    	<div id="tableViewCell<?php echo $v['id'];?>" class="tableViewCell <?php echo $csssuffix;?>">
                    <div class="cornerControls">
                                                    <a href="/article/show.php?id=<?php echo $v['id'];?>" id="text<?php echo $v['id'];?>" class="actionButton textButton" title="Text-only version">Text</a>
                        
                                                                                                                        <a href="/article/skip.php?id=<?php echo $v['id'];?>" id="skip<?php echo $v['id'];?>" class="actionButton archiveButton" title="Move to Archive">Archive</a>
                                                                                                                
                    </div> <!-- cornerControls -->

                    <div class="likeBox">
                            
                             <a style=" <?php echo $like;?> background-color: transparent;" id="starButton<?php echo $v['id'];?>" title="Like this article" class="starToggleUnstarred" href="/article/liketoggle.php?id=<?php echo $v['id'];?>"><img src="/images/unliked.png"></a>
							
                            <a style="<?php echo $unlike;?> background-color: transparent;" id="unstarButton<?php echo $v['id'];?>" title="Un-like this article" class="starToggleStarred" href="/article/liketoggle.php?id=<?php echo $v['id'];?>"><img src="/images/liked.png"></a>
							
                            <a id="starProgress<?php echo $v['id'];?>" style="display: none;" onclick="this.blur(); return false;" class="starToggleProgress" href="/article/liketoggle.php?id=<?php echo $v['id'];?>"><img src="/images/loader-gray.gif"></a>
                                                    
                    </div>
                    
                    <div class="titleRow">
                        <a href="<?php echo $v['url'];?>" class="tableViewCellTitleLink" ><?php echo $v['title'];?></a>
                        <div class="summary">
                                                    </div>
                    </div>
                    
                    <div id="secondaryControls<?php echo $v['id'];?>" class="secondaryControls">
                        <span class="host"><?php echo parse_url($v['url'], PHP_URL_HOST);?></span>

                        <span class="separator">•</span> 
                        <a onclick="return show_share_panel('<?php echo $v['id'];?>','<?php echo $v['url'];?>','<?php echo $v['title'];?>','');" href="#" title="Share..." class="actionLink">分享</a>

                                                                                    <span class="separator">•</span> <a href="/article/edit.php?id=<?php echo $v['id'];?>" title="Edit" class="actionLink">编辑</a>
                            
                                                            <span class="separator">•</span> <a onclick="document.getElementById('foldermenu<?php echo $v['id'];?>').style.display = 'block'; return false;" href="#" title="Move to folder..." class="actionLink">Move</a>
                            
                                                            <span class="separator">•</span> <a href="/article/del.php?id=<?php echo $v['id'];?>" style="color: rgb(119, 0, 0);" id="dele<?php echo $v['id'];?>" title="Permanently delete" class="actionLink deleteLink">Delete</a>
                            
                                                           
                                                                        </div> <!-- secondaryControls -->
                                                    
                    <div class="clear">&nbsp;</div>
            
                </div>
    	
    <?php
	}
	echo '</div>';
}
?>
    <!-- end left column -->
</div>

<div id="right_column">

    
            <h3 class="section_header" style="margin: 30px 0 15px 0;">Folders</h3>
        <div id="folder_container">
            <div id="folders">                
                                    <div style="margin-top: 5px; font-size: 11px;">
                        <img src="/images/folder-tiny.png" style="width: 12px; height: 9px; margin-right: 2px;"/>
                        <a href="/edit_folder" style="color: #555; text-decoration: underline;">Add folders</a>
                        to organize your articles.
                    </div>

                            </div>
            <div style="clear: both; font-size: 1px; line-height: 1px;">&nbsp;</div>
        </div>
         
            <div id="tools_container">
                                    <p style="margin-bottom: 3px;">Save directly to this folder:</p>
                        <a href="javascript:(function(){readStyle='style-newspaper';readSize='size-large';readMargin='margin-wide';_readability_script=document.createElement('SCRIPT');_readability_script.type='text/javascript';_readability_script.src='http://www.xiabandu.com/user/jsfile.php?identity=<?php echo $user[0]['identity'];?>&x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(_readability_script);})();"
    class="bookmarklet"
    onclick="return explain_bookmarklet();"
    title="DUDU">DUDU</a>
                            </div>
            
       
        
            <h3 class="section_header" style="margin: 30px 0 7px 0; cursor: pointer;"
         onclick="
            var e = document.getElementById('backupbox');
            var t = document.getElementById('backuptoggle');
            if (e.style.display == 'block') {
                e.style.display = 'none';
                t.innerHTML = '+'
            } else {
                e.style.display = 'block';                
                t.innerHTML = '&ndash;'
            }
         "
        >

            <span id="backuptoggle" style="float: right;">+</span>
            Export CSV&hellip;
        </h3>

        <div id="backupbox" style="display: none; font-size: 13px;">
            This generates a file containing a list of your saved articles, 
            in case you want it for backup or data portability.<br/><br/>
            It may take a minute or two to generate if you have a lot of articles.
            <form action="/export/csv" method="post" onsubmit="
                if (confirm('This may take a few minutes. Ready?')) {
                    document.getElementById('download_csv_button').disabled = 1;
                    document.getElementById('download_csv_button').value = 'Generating...';
                    return true;
                } else return false;
            ">

                <input type="hidden" id="form_key" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
                <input type="submit" value="Download CSV file" id="download_csv_button" style="display: block; width: 80%; margin: 1em auto;"/>
            </form>
            <form action="/export/html" method="post" onsubmit="
                if (confirm('This may take a few minutes. Ready?')) {
                    document.getElementById('download_html_button').disabled = 1;
                    document.getElementById('download_html_button').value = 'Generating...';
                    return true;
                } else return false;
            ">
                <input type="hidden" id="form_key" name="form_key" value="vhJujIYEQETvEE5wOx1T"/>
                <input type="submit" value="Download HTML file" id="download_html_button" style="display: block; width: 80%; margin: 1em auto;"/>
            </form>
            If you have more than 2,000 articles, only the most recent 2,000 will be included.
        </div>

    
            <h3 class="section_header" style="margin: 30px 0 7px 0;">Subscribe</h3>
        <div style="font-size: 13px; margin-bottom: 50px;">
            You can <a href="/subscription">support Instapaper</a>
            for only $1/month.
        </div>
        
    <!-- end right column -->
</div>


<script type="text/javascript"><!--
attach_ajax();
--></script>

        </div>

        <div id="footer">

            <a href="/faq">FAQ</a> &bull;
            <a href="/main/support">Support</a> &bull;

            <a href="/iphone">iPhone App</a> &bull;
            <a href="http://blog.instapaper.com/">Blog</a> &bull;
            <a href="http://twitter.com/instapaper">Twitter</a> &bull;
            <a href="/publishers">Information for Publishers</a> &bull;
            <a href="/press-kit">Press Kit</a> &bull;

            <a href="/privacy-policy">Privacy Policy</a> &bull;
            <a href="/api/full">API</a>

                            &bull;
                <a href="http://www.instapaper.com/rss/1436358/IDJQDaVUBpucrOKh4inSIDgqBQ"><img src="/images/rss.png"/></a>
                <a href="http://www.instapaper.com/rss/1436358/IDJQDaVUBpucrOKh4inSIDgqBQ">This folder&rsquo;s RSS</a>
            
            <div style="margin-top: 1em;">

            &copy;&nbsp;2008-2011 Instapaper, LLC.
            Contact <a href="http://www.marco.org/">Marco Arment</a>, founder:
            <a href="mailto:instapaper@marco.org">instapaper@marco.org</a>.
            </div>
        </div>
        <script type="text/javascript">

          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'UA-638312-6']);
          _gaq.push(['_trackPageview']);

          (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
          })();

        </script>
    </body>
</html>

